<?php
/**
 * Created by PhpStorm.
 * User: zhaofengjun
 * Date: 2019/4/1
 * Time: 9:42
 */

namespace app\common\model;

class OrderDetails extends Model
{
    protected $name = 'order_details';
    //protected $autoWriteTimestamp = true;

    /**
     * 获取订单所属的商品
     */
    public function goodsAll()
    {
        return $this->belongsTo('GoodsL','goods_id','id');
    }



    protected function getStatusTextAttr($vaule, $data)
    {
        $text = [
            0 => '未支付',
            1 => '已支付'
        ];
        return $text[$data['status']];
    }

    protected function getLastLoginTimeAttr($value)
    {
        return $value>0?date('Y-m-d H:i:s',$value):'/';
    }


    protected function getRegTimeAttr($value)
    {
        return $value>0?date('Y-m-d H:i:s',$value):'/';
    }


}